/*
 *  Copyright 2005 Blandware (http://www.blandware.com)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.blandware.atleap.persistence.forum;

import com.blandware.atleap.persistence.core.DAO;
import com.blandware.atleap.model.forum.Topic;
import com.blandware.atleap.model.forum.Post;
import com.blandware.atleap.model.forum.Forum;
import com.blandware.atleap.common.util.PartialCollection;
import com.blandware.atleap.common.util.QueryInfo;

/**
 * <p>DAO for topics.</p>
 * <p><a href="TopicDAO.java.html"><i>View source</i></a></p>
 *
 * @author Roman Puchkovskiy <a href="mailto:roman.puchkovskiy@blandware.com">
 *         &lt;roman.puchkovskiy@blandware.com&gt;</a>
 * @version $Revision: 1.2 $ $Date: 2006/06/16 15:21:24 $
 */
public interface TopicDAO extends DAO {

    // ~ CRUD Methods ================================================================

    /**
     * Creates a topic in a given forum assigning its first post.
     *
     * @param topic topic to create
     * @param forum topic owner
     * @param firstPost post which begins this topic
     * @return ID of created topic
     */
    public Long createTopic(Topic topic, Forum forum, Post firstPost);

    /**
     * Retrieves a topic by its ID.
     *
     * @param topicId ID of topic to retrieve
     * @return found topic
     */
    public Topic retrieveTopic(Long topicId);

    /**
     * Deletes a given topic.
     *
     * @param topic topic to delete
     */
    public void deleteTopic(Topic topic);

    // ~ Additional methods ================================================================

    /**
     * Retrieves filtered/sorted collection of topics
     *
     * @param queryInfo Object that contains information about how to filter
     * and sort data
     * @return Collection of topics
     */
    public PartialCollection listTopics(QueryInfo queryInfo);
}
